package com.shenyun.test;

import com.shenyun.pojo.Student;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

public class Main {
    public static void main(String[] args) throws IOException {
        //读取核心配置文件product-config.xml
        InputStream inputStream;
        inputStream = Resources.getResourceAsStream("spring-config.xml");
        //根据配置文件创建SqlSessionFactory对象
        SqlSessionFactory ssf;
        ssf = new SqlSessionFactoryBuilder().build(inputStream);
        //通过SqlSessionFactory创建SqlSession对象
        SqlSession session = ssf.openSession();
        List<Student> list = session.selectList("queryStudents");
        System.out.println(list);
    }
}